//
//  UIButton+Extension.swift
//  HYYWeibo
//
//  Created by HY-Mac on 16/7/8.
//  Copyright © 2016年 HY-Mac. All rights reserved.
//

import UIKit

extension UIButton{
    
    convenience init(imageName: String?, bgImageName: String?) {
        self.init()
        if imageName != nil{
        setImage(UIImage(named: imageName!), forState: .Normal)
        setImage(UIImage(named: imageName! + "_highlighted"), forState: .Highlighted)
        }
        
        if bgImageName != nil{
        setBackgroundImage(UIImage(named: bgImageName!), forState: .Normal)
        setBackgroundImage(UIImage(named: bgImageName! + "_highlighted"), forState: .Highlighted)
        }
        self.sizeToFit()
    }
}